<html>
<head><meta charset="utf-8"><title>How can I only fix some warnings? · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html">How can I only fix some warnings?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214646323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214646323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214646323">(Oct 26 2020 at 23:41)</a>:</h4>
<p>I'm running <code>cargo clippy --fix</code> on some very large codebases (mostly stdarch and rustc). Fixing everything at once is too large a diff to review by hand, so I want to split it out into multiple commits (maybe even multiple PRs). Is there a way to say 'only fix this particular lint'?</p>



<a name="214646409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214646409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214646409">(Oct 26 2020 at 23:42)</a>:</h4>
<p>You could try <code>cargo clippy --fix -- -Aclippy::all -Wclippy::&lt;lint_name&gt;</code></p>



<a name="214646439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214646439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214646439">(Oct 26 2020 at 23:43)</a>:</h4>
<p>If the <code>--</code> thing doesn't work, try the same  with <code>RUSTFLAGS="-Aclippy::all -Wclippy::&lt;lint_name&gt;" cargo clippy --fix</code></p>



<a name="214648306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214648306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214648306">(Oct 27 2020 at 00:11)</a>:</h4>
<p>it turns out this doesn't actually work because the flags are passed to <em>all</em> invocations of cargo, not just clippy</p>
<div class="codehilite"><pre><span></span><code>    Checking simd-test-macro v0.1.0 (/home/joshua/src/rust/stdarch/crates/simd-test-macro)
error[E0602]: unknown lint: `clippy::unusual_byte_groupings`
  |
  = note: requested on the command line with `-A clippy::unusual_byte_groupings`
</code></pre></div>



<a name="214648319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214648319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214648319">(Oct 27 2020 at 00:11)</a>:</h4>
<p>is there a <code>cargo clippy-driver</code> or something?</p>



<a name="214648547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214648547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214648547">(Oct 27 2020 at 00:15)</a>:</h4>
<p>Hm, normally rustc should ignore lints from tools, if they aren't available <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="214648642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214648642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214648642">(Oct 27 2020 at 00:16)</a>:</h4>
<p>It seems it does not for command-line args <a href="https://github.com/rust-lang/rust/issues/69453">#69453</a></p>



<a name="214649153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214649153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214649153">(Oct 27 2020 at 00:25)</a>:</h4>
<p>Oh this gets even worse - clippy will still fix the code even though warnings weren't displayed</p>



<a name="214649239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214649239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214649239">(Oct 27 2020 at 00:26)</a>:</h4>
<p>oh wait hold on</p>



<a name="214649251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214649251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214649251">(Oct 27 2020 at 00:27)</a>:</h4>
<p>oops, I was just allowing the wrong warning haha</p>



<a name="214649446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214649446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214649446">(Oct 27 2020 at 00:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F/near/214649251">said</a>:</p>
<blockquote>
<p>oops, I was just allowing the wrong warning haha</p>
</blockquote>
<p>Puh, you shocked me there for a bit. I'll go to sleep now, before you discover a real bug. <span aria-label="in bed" class="emoji emoji-1f6cc" role="img" title="in bed">:in_bed:</span></p>



<a name="214649609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214649609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214649609">(Oct 27 2020 at 00:33)</a>:</h4>
<p><em>you can't escape me that easily</em> <a href="https://github.com/rust-lang/rust-clippy/issues/6232">https://github.com/rust-lang/rust-clippy/issues/6232</a></p>



<a name="214658270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214658270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214658270">(Oct 27 2020 at 03:33)</a>:</h4>
<p>ok I think this is enough error reports for one night <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="214658271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214658271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214658271">(Oct 27 2020 at 03:33)</a>:</h4>
<p>good luck have fun</p>



<a name="214667784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214667784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214667784">(Oct 27 2020 at 07:31)</a>:</h4>
<p>Don't hesitate to open more, this is gold. It will help to make Clippy better.</p>



<a name="214695531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20only%20fix%20some%20warnings%3F/near/214695531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20only.20fix.20some.20warnings.3F.html#214695531">(Oct 27 2020 at 13:03)</a>:</h4>
<p>They all came for free, I just had to grep for 'Original warnings' when running clippy --fix on rustc :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>